<include file="header" />
<body>
<div class="wraper margin-none">
    <div class="top">
        <a href="javascript:history.go(-1);" class="iconfont icon-zuo pull-left"></a>
	    <span class="pull-left">添加<if condition="$ecs_id eq 9">商户<else/>寝室</if>
	    </span>
        <a href="{BEESCRM::U('base/ecs/index',array('ecs_id'=>$ecs_id))}" class="iconfont icon-shouye pull-right text-right"></a>
    </div>
    <div class="margin-top">
        <p class="form-box">
            <select id="community">
                <option value="0">请选择园区</option>
                <volist name="community" id="vo">
                    <option value="{BEESCRM:$vo.community_id}" >{BEESCRM:$vo.community_name}</option>
                </volist>
            </select>
            <span class="triangle"></span>
        </p>
        <p class="form-box">
            <select id="building">
                <option value="0">请选择楼幢</option>
            </select>
            <span class="triangle"></span>
        </p>
        <p class="form-box">
            <select id="floor">
                <option value="0">请选择楼层</option>
            </select>
            <span class="triangle"></span>
        </p>
        <p class="form-box">
            <select id="room">
                <option value="0">请选择<if condition="$ecs_id eq 9">商户<else/>寝室</if></option>
            </select>
            <span class="triangle"></span>
        </p>
    </div>
    <div class="btn-box">
        <a href="javascript:void(0);" class="btn">确认提交</a>
    </div>
</div>
<include file="commonJS" />
<script src="/assets/base/common/ajaxgetroominfo.js"></script>
<script>
	$(function(){
		ajaxgetroominfo(true,true,true);
		$('.btn').on('click',function(){
			var ecs_id = "{BEESCRM:$ecs_id}";
			var community = $('#community').val();
			var building = $('#building').val();
			var floor = $('#floor').val();
			var room = $('#room').val();
			if(room == 0 || !room){
				$.layeralert('请选择寝室');
				return false;
			}
			$.ajax({
				'url': "/base/ecs/addEleRemind",
				'data': {community:community,building:building,floor:floor,room:room,ecs_id:ecs_id},
				'dataType':'json',
				'type': 'GET',
				'async': false,
				success: function(data){
					if(data.status == 'S'){
						$.layeralert(data.message);
					}else{
						$.layeralert(data.message);
					}
					setTimeout("window.location.href='/base/ecs/eleRemind/ecs_id/{BEESCRM:$ecs_id}'",2000);

				}
			});
		});
	});
</script>
</body>
</html>